<%--
    Document   : nguoidung_chinhsua
    Created on : Nov 23, 2011, 8:50:31 PM
    Author     : kydrenw
--%>
<%@page import="pojo.Nguoidung"%>
<%@page import="java.util.Date"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<div class="box-head">Sửa thông tin người dùng</div>

<form id="frmdangky" method="post" action="nguoidung.htm" onSubmit="return check_frm_dangky()" class="infoForm">
    <div class="info">
        <span class="label">Tên Đăng Nhập</span>
        <input type="hidden" name="txttendangnhap" value="${nguoidung.tendangnhap}"/>
        <span><input id="txttendangnhap" type="text" value="${nguoidung.tendangnhap}" disabled="true"/> </span>
    </div>

    <div class="info">
        <span class="label">Mật Khẩu </span>
        <span><input id="txtmatkhau" name="txtmatkhau" type="password" value="${nguoidung.matkhau}" disabled="true" /> </span>
    </div>

    <div class="info">
        <span class="label">Trạng thái</span>
        <span>
            <select name="tinhtrang">
                <c:forEach var="item" items="${dsTinhTrang}">
                    <option value="${item.ma}"
                            <c:if test="${nguoidung.tinhtrang.ma==item.ma}">
                                selected="selected"
                            </c:if>
                            >${item.ten}</option>
                </c:forEach>
            </select>
        </span>
    </div>

    <div class="info">
        <span class="label">Quyền</span>
        <span>
            <c:forEach var="item" items="${dsQuyenhan}">
                <input type="checkbox" name="${item.ma}" value="1"
                       <c:forEach var="quyen" items="${nguoidung.quyenhans}">
                           <c:if test="${quyen.ma==item.ma}">
                               checked
                           </c:if>
                       </c:forEach>
                       />${item.ten}
            </c:forEach>
        </span>
    </div>

    <div class="info">
        <span class="label">Email</span>
        <span><input id="txtemail" name="txtemail" type="text"  size="30" value="${nguoidung.email}" disabled="true" /></span>
    </div>

    <div class="info">
        <span class="label">Họ Tên </span>
        <span><input id="txthoten" name="txthoten" type="text" size="30" value="${nguoidung.hoten}" disabled="true"/> </span>
    </div>

    <div class="info">
        <span class="label">Số Điện Thoại</span>
        <span><input id="txtdienthoai" name="txtdienthoai" type="text" value="${nguoidung.sodienthoai}" disabled="true"/></span>
    </div>

    <div class="info">
        <span class="label">Giới Tính </span>
        <span><input name="gioitinh" type="radio" value="Nam" checked="checked" disabled="true"/>
            Nam
            <input name="gioitinh" type="radio" value="Nữ" disabled="true"/>
            Nữ
        </span>
    </div>

    <div class="info">
        <span class="label">Ngày Sinh </span>
        <%
            Nguoidung user = (Nguoidung) request.getAttribute("nguoidung");
            java.util.Date ngaysinh = user.getNgaysinh();
            java.text.SimpleDateFormat ngayFormat = new java.text.SimpleDateFormat("dd");
            java.text.SimpleDateFormat thangFormat = new java.text.SimpleDateFormat("mm");
            java.text.SimpleDateFormat namFormat = new java.text.SimpleDateFormat("yyyy");
            String ngayS = ngayFormat.format(ngaysinh.getTime());
            String thangS = thangFormat.format(ngaysinh.getTime());
            String namS = namFormat.format(ngaysinh.getTime());
            int ngay = Integer.parseInt(ngayS);
            int thang = Integer.parseInt(thangS);
            int nam = Integer.parseInt(namS);
        %>
        <span>Ngày  <input id="txtngay" name="txtngay" type="text" value="<%=ngay%>"  style="width: 30px;" disabled="true"/>
            Tháng <input id="txtthang" name="txtthang" type="text" value="<%=thang%>" style="width: 30px;" disabled="true"/>
            Năm   <input id="txtnam"  name="txtnam" type="text" value="<%=nam%>"   style="width: 30px;" disabled="true"/>
        </span>
    </div>

    <div class="info">
        <span class="label">Địa Chỉ </span>
        <span><input id="txtdiachi" name="txtdiachi" type="text" size="38" value="${nguoidung.diachi}" disabled="true"/></span>
    </div>
    <div class="message">
        ${mess}
    </div>

    <div class="command">
        <input type="hidden" name="action" value="sua_submit"/>
        <input type="submit" name="btnCapNhat" value="Cập nhật" />
        <input type="reset" name="btnHuy" value="Hủy"/>
        <input type="button" name="btnQuayLai" value="Quay Lại" onclick="window.location='nguoidung.htm'"/>
    </div>
</form>